//
//  ViewController.m
//  sounds
//
//  Created by iD Student on 7/25/13.
//  Copyright (c) 2013 idstudent. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSURL *brl = [[NSBundle mainBundle] URLForResource:@"explosionButtonPressed" withExtension:@"mp3"];
    NSError *error;
    explosionSound= [[AVAudioPlayer alloc] initWithContentsOfURL: brl error: &error];
    if(error != nil)
    {
        //This happens when the sound cannot be loaded
        NSLog(@"Explosion sound could not be loaded!");
    }
    
    
    brl = [[NSBundle mainBundle] URLForResource:@"laserButtonPressed" withExtension:@"mp3"];
    error= nil;
    laserSound = [[AVAudioPlayer alloc] initWithContentsOfURL:brl error:&error];
    if(error != nil)
    {
        //This happens when the sound cannot be loaded
        NSLog(@"Laser sound could not be loaded!");
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)explosionButtonPressed:(id)sender
{
    [explosionSound play];
}

- (IBAction)laserButtonPressed:(id)sender
{
    [laserSound play];
}
@end
